package com.vmj.instructions.loads;

import com.vmj.heap.VMObject;
import com.vmj.rtda.Frame;

/**
 * Created by yangshoujun on 2017/8/19 上午12:23.
 */
public class LoanUtils {

    public static void iload(Frame frame, int index) {
        int value = frame.getLocalVars().getInt(index);
        frame.getOperandStack().pushInt(value);
    }

    public static void aload(Frame frame, int index) {
        VMObject ref = frame.getLocalVars().getRef(index);
        frame.getOperandStack().pushRef(ref);
    }

    public static void fload(Frame frame, int index) {
        float value = frame.getLocalVars().getFloat(index);
        frame.getOperandStack().pushFloat(value);
    }

    public static void lload(Frame frame, int index) {
        long value = frame.getLocalVars().getLong(index);
        frame.getOperandStack().pushLong(value);
    }
}
